package com.UtilsPak.xml;




import java.io.File;
import java.net.URL;

import org.jdom.Document;
import org.jdom.Element;
import org.jdom.JDOMException;
import org.jdom.input.SAXBuilder;

/**
 * Created by IntelliJ IDEA.
 * User: mchebanenko
 * Date: 10-Dec-2010
 * Time: 5:07:39 PM
 * To change this template use File | Settings | File Templates.
 */
public class XmlManager {


    public static Element getRootElement(URL file) {

    Element retVal = null;
   // File file = new File(filePath);

/*    if ( ! (file.exists() && file.canRead())) {
        System.err.println("Error: cannot read "+filePath);
    }*/

        try {
            SAXBuilder saxBuilder = new SAXBuilder();
            Document document = saxBuilder.build(file);
            retVal = document.getRootElement();
        }
        catch (Exception e) {
            e.printStackTrace();
        }
     return retVal;
    }
}